﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.ObjectModel;
using System.ComponentModel;

namespace Windows_Phone_Audio_Recorder
{
    public class ViewModel : INotifyPropertyChanged
    {
        ObservableCollection<int> m_ocData = new ObservableCollection<int>();

        public ViewModel()
        {
            
        }

        private void NotifyPropertyChanged(String info)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(info));
            }
        }

        public void LoadAudioData(byte[] baSource)
        {
            ObservableCollection<int> ocTemp = new ObservableCollection<int>();
            for (int nIndex = 0; nIndex < 100; nIndex++)
            {
                ocTemp.Add(baSource[nIndex]);
            }
            AudioData = ocTemp;
        }
        public ObservableCollection<int> AudioData
        {
            get { return m_ocData; }
            set 
            {
                m_ocData = value;
                NotifyPropertyChanged("AudioData");
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;
    }
}
